<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>吃豆人</title>
</head>

<body>
    <canvas id="canvas" width="500" height="300"
        style="display: block; margin: 100px auto; border: 1px solid #aaa"></canvas>

    <script>
        const canvas = document.getElementById("canvas");
        const ctx = canvas.getContext("2d");

        /* 身体 */
        ctx.beginPath();
        ctx.arc(150, 150, 100, [(Math.PI) / 180] * 30, [(Math.PI) / 180] * 330);
        ctx.lineTo(150, 150);
        ctx.closePath();
        ctx.fillStyle = "#ffd11f";
        ctx.fill();

        /* 眼睛 */
        ctx.beginPath();
        ctx.arc(170, 100, 12, 0, 2 * Math.PI);
        ctx.fillStyle = "black";
        ctx.fill();

        /* 豆子 */
        ctx.beginPath();
        ctx.arc(200, 150, 10, 0, 2 * Math.PI);
        ctx.arc(300, 150, 10, 0, 2 * Math.PI);
        ctx.arc(400, 150, 10, 0, 2 * Math.PI);
        ctx.fillStyle = "#CEA500";
        ctx.closePath();
        ctx.fill();
    </script>
</body>

</html>